package com.ffyc.ssm.controller;

import com.ffyc.ssm.common.CommonResult;
import com.ffyc.ssm.modle.NewsType;
import com.ffyc.ssm.service.Front_NesTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(path="/front_NesTypeController")
public class Front_NesTypeController {

    @Autowired
    Front_NesTypeService front_nesTypeService;

    @GetMapping(path = "/getNesType")
    public CommonResult getNesType(){

        CommonResult commonResult;
        try{
            List<NewsType> newsTypes= front_nesTypeService.getNesType();
            commonResult=new CommonResult(200,"查找成功",newsTypes);
        }catch(Exception e){
            e.printStackTrace();
            commonResult=new CommonResult(500,"服务器忙",null);
        }
        return commonResult;
    }
}
